<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script >
		/* 	var n = eval("1+2");
			alert(n); */
			
			function sum2(op){
					var i =Number(document.forms[0].i.value);
					var i1 = Number(document.forms[0].i1.value);
					
					var sum  = eval(i+op+i1);
					/* if( op == "+"){
						sum = i + i1;
					}else if(op == "-"){
						sum = i - i1;
					}else if(op == "*"){
						sum = i * i1;
					}else if(op == "/"){
						sum = i / i1;
					} */
				
					document.forms[0].sum.value = sum;
				}
		</script>
	</head>
	<body>
		<form >
			第一个数：<input type="text" name="i" value="" /><br>
			第二个数：<input type="text" name="i1" value="" /><br>
			<input type="button" value="+" onclick="sum2('+')"/>
			<input type="button" value="-" onclick="sum2('-')"/>
			<input type="button" value="*" onclick="sum2('*')"/>
			<input type="button" value="/" onclick="sum2('/')"/><br>
			和：<input type="text" name="sum" value="" />
		</form>
	</body>
</html>
